$(function () {
    $("#jqGrid").jqGrid({
        url: baseURL + 'sys/teamperformance/list',
        datatype: "json",
        colModel: [			
			{ label: 'id', name: 'id', index: 'id', width: 50, key: true },
			{ label: '用户id', name: 'userId', index: 'user_id', width: 80 },
            { label: '手机号码', name: 'mobile', index: 'mobile', width: 80 },
            { label: '层级', name: 'route', index: 'route', width: 80 },
            { label: '上级推荐人', name: 'path', index: 'path', width: 80 },
			{ label: '用户本身业绩', name: 'performance', index: 'performance', width: 80 },
			{ label: '团队总业绩', name: 'teamPerformance', index: 'team_performance', width: 80 }, 			
			{ label: '今日时间', name: 'todayTime', index: 'today_time', width: 80 },
			{ label: '昨日时间', name: 'yesterdayTime', index: 'yesterday_time', width: 80 },
			{ label: '创建时间', name: 'createTime', index: 'create_time', width: 80 },
			{ label: '最后更新时间', name: 'updateTime', index: 'update_time', width: 80 }, 			
        ],
		viewrecords: true,
        height: 385,
        rowNum: 10,
		rowList : [10,30,50],
        rownumbers: true, 
        rownumWidth: 25, 
        autowidth:true,
        multiselect: true,
        pager: "#jqGridPager",
        jsonReader : {
            root: "page.list",
            page: "page.currPage",
            total: "page.totalPage",
            records: "page.totalCount"
        },
        prmNames : {
            page:"page", 
            rows:"limit", 
            order: "order"
        },
        gridComplete:function(){
        	//隐藏grid底部滚动条
        	$("#jqGrid").closest(".ui-jqgrid-bdiv").css({ "overflow-x" : "hidden" }); 
        }
    });
});

var vm = new Vue({
	el:'#rrapp',
	data:{
	    q:{
            mobile: null
        },
		showList: true,
		title: null,
		teamPerformance: {}
	},
	methods: {
		query: function () {
			vm.reload();
		},
		reload: function (event) {
			vm.showList = true;
			var page = $("#jqGrid").jqGrid('getGridParam','page');
            var params=	{'mobile':vm.q.mobile};
			$("#jqGrid").jqGrid('setGridParam',{ 
                page:page,
                postData:params
            }).trigger("reloadGrid");
		},
        reset:function(){
            vm.q = {mobile:null};
            $("input[name='qInput']").val('');
            vm.reload();
        },
	}
});